<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
declare(strict_types=1);

use think\facade\Route;

// Route::get('think', function () {
//     return 'hello,ThinkPHP8!';
// });

// Route::get('hello/:name', 'index/hello');


Route::group('api/v1', function () {
    // 用户登录注册（不需要认证）
    Route::post('user/login', 'v1.UserLoginController/login');      // 注册
    Route::get('comment/agreement', 'v1.CommentController/agreement');
    Route::post('user/uploadAvatar', 'v1.UserLoginController/uploadAvatar');
    // 获取用户地址
    Route::get('user/address', 'v1.UserController/getUserAddress');
    Route::get('comment/area', 'v1.CommentController/getArea');
    // 保存用户添加的地址
    Route::post('user/address', 'v1.UserController/saveUserAddress');
    // 获取地址信息
    Route::get('user/addressInfo', 'v1.UserController/getAddressInfo');
    // 获取用户信息
    Route::get('user/info', 'v1.UserController/info');
    // 获取用户足迹
    Route::get('user/footprint', 'v1.UserController/getMyFootprint');
    // 获取用户收藏店铺
    Route::get('user/collectionShop', 'v1.UserController/getMyCollectionShop');
    // 获取用户收藏商品
    Route::get('user/collectionGoods', 'v1.UserController/getMyCollectionGoods');
    // 获取用户小程序码
    Route::get('user/getUserMiniQrcode', 'v1.UserController/getUserMiniQrcode');

    /************************* 景点 *********************************** */
    // Route::get('travel/scenicSpots', 'v1.TravelController/getScenicSpotList');
    Route::get('travel/scenicSpots/getSpotList', 'v1.TravelController/getSpotList');
    Route::get('travel/scenicSpots/detail', 'v1.TravelController/getScenicSpotDetail');
    Route::get('travel/scenicSpots/:id/tickets', 'v1.TravelController/getScenicSpotTickets');
    // 景点喜欢
    Route::get('travel/scenicSpots/like', 'v1.TravelController/spotLike');

    // 获取优惠卷
    Route::get('travel/getTicketCoupons', 'v1.CouponController/getTicketCoupons');

    // 提交门票订单
    Route::post('travel/submitTicketOrders', 'v1.OrderController/submitTicketOrders');
    // 获取门票订单列表
    Route::get('travel/getTicketOrderList', 'v1.OrderController/getTicketOrderList');
    // 门票退款
    Route::post('travel/refundTicketOrder', 'v1.OrderController/refundTicketOrder');
    //核销门票
    Route::post('travel/verifyTicket', 'v1.OrderController/verifyTicket');

    /*********************产品 *********************************** */
    // 收藏产品
    Route::get('product/favorite/add', 'v1.ProductController/likeProduct');
    // 获取产品详情
    Route::get('product/normal_detail', 'v1.ProductController/getNormalProductDetail');
    // 获取产品二维码
    Route::get('product/mini_qrcode', 'v1.ProductController/getMiniQrcode');
    // 搜索产品
    Route::get('product/search', 'v1.ProductController/getSearchProduct');


    /*********************************** 购物车 *********************************** */ 
    //加入购物车
    Route::post('cart/add', 'v1.CartController/addCart');
    //获取选中的购物车产品
    Route::get('cart/getCartSelected', 'v1.CartController/getCartSelected');
    // 购物车获取
    Route::get('cart/getCartList', 'v1.CartController/getCartList');
    // 购物车自增
    Route::get('cart/increment', 'v1.CartController/increment');
    // 购物车自减
    Route::get('cart/decrement', 'v1.CartController/decrement');
    // 删除购物车产品
    Route::get('cart/delete', 'v1.CartController/deleteCartItem');
    // 清空用户购物车
    Route::get('cart/clear', 'v1.CartController/clearCart');
    // 购物车选中
    Route::get('cart/selectedCartItem', 'v1.CartController/selectedCartItem');

    //******************** 订单 *********************************** */
    // 确认下单
    Route::post('order/createMallOrder', 'v1.OrderController/createMallOrder');
    // 获取订单列表
    Route::get('order/getMallOrderList', 'v1.OrderController/getMallOrderList');
    // 确认收货
    Route::post('order/confirmReceipt', 'v1.OrderController/confirmMallOrderReceipt');
    // 申请商城订单 退款
    Route::post('order/applyMallOrderRefund', 'v1.OrderController/applyMallOrderRefund');

    Route::get('comment/banner', 'v1.CommentController/getBanner');
    Route::get('comment/gridList', 'v1.CommentController/gridList');

    // 热门爆品推荐
    Route::get('product/hotRecommend', 'v1.ProductController/getHotRecommend');


    //**********************会员 *********************************** */
    // 获取用户详情
    Route::get('user/detail', 'v1.UserController/getUserDetail');


    /******************** 优惠券 *********************************** */
    // 获取优惠券列表
    Route::get('coupon/getCouponList', 'v1.CouponController/getCouponList');
    // 领取优惠券
    Route::get('coupon/receiveCoupon', 'v1.CouponController/receiveCoupon');
    // 使用优惠券
    Route::get('coupon/getMyCouponList', 'v1.CouponController/getMyCouponList');


    /******************** 店铺 *********************************** */
    // 获取店铺信息
    Route::get('shop/info', 'v1.ShopController/getShopInfo');
    Route::get('shop/product', 'v1.ShopController/getShopProduct');
    // 取消关注、关注店铺
    Route::get('shop/toggleFollow', 'v1.ShopController/toggleFollow');
    // 获取评价
    Route::get('shop/getShopReviews', 'v1.ShopController/getShopReviews');
})->middleware('encryption');

// 支付回调
Route::post('api/wechat/pay/notify', 'v1.PayController/wechatNotify');